package BanyuanClub.Study.Day0309.死锁;

public class Deadlock {

    public static void main(String[] args) {
        A a = new A();
        B b = new B();
        new Thread(() -> {
            synchronized (a){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                synchronized (b){

                }
            }
        }).start();

        new Thread(() -> {
            synchronized (b){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                synchronized (a){

                }
            }
        }).start();


    }
}

class A{

}

class B{

}